package com.wenjunwu.blog.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.wenjunwu.blog.common.BaseDao;
import com.wenjunwu.blog.dao.SystemRoleDao;
import com.wenjunwu.blog.entity.SystemRole;

@Repository
public class SystemRoleDaoImpl extends BaseDao<SystemRole> implements SystemRoleDao {

	@Override
	public int insert(SystemRole record) {
		return sqlSession.insert(DEFAULTNAMESPACE.concat("insertSelective"), record);
	}

	@Override
	public int updateByPrimaryKeySelective(SystemRole record) {
		return sqlSession.update(DEFAULTNAMESPACE.concat("updateByPrimaryKeySelective"), record);
	}

	@Override
	public List<SystemRole> selectByUsername(String username) {
		return sqlSession.selectList(DEFAULTNAMESPACE.concat("selectByUsername"), username);
	}

	@Override
	public List<SystemRole> selectAllRoles() {
		return sqlSession.selectList(DEFAULTNAMESPACE.concat("selectAllRoles"));
	}

	@Override
	public SystemRole selectByPrimaryKey(Long id) {
		return sqlSession.selectOne(DEFAULTNAMESPACE.concat("selectByPrimaryKey"), id);
	}

	@Override
	public SystemRole selectByRoleName(String roleName) {
		return sqlSession.selectOne(DEFAULTNAMESPACE.concat("selectByRoleName"), roleName);
	}

}
